

 class Equation {
    float a;
    float b;
    float c;

    public Equation(float a, float b, float c) {
        this.a = a;
        this.b = b;
        this.c = c;
    }
    public  void qiujie(){
        double x1;
        double x2;

        if (b*b-4*a*c<0){
            System.out.println("这方程无解");



        }
        else if (b*b-4*a*c>0){
            x1=(-b+Math.sqrt(b*b-4*a*c))/2*a;
            x2=(-b-Math.sqrt(b*b-4*a*c))/2*a;
            System.out.println("此方程的解x1="+x1+"x2="+x2);





        }
        else
        {
            x1=-b/2*a;
            x2=-b/2*a;
            System.out.println("此方程有相同解x1=x2"+x1);
        }
    }
}





public class text9 {
    public static void main(String[] args) {
        Equation a=new Equation(5,5,1);
        a.qiujie();

    }




}

